import React from "react";
import { View, Image } from "@tarojs/components";
import api from "@api/api.js";
export default (props) => {
  const dom = (item) => {
    return (
      <View
        className={
          props.clinicSchemesId && props.clinicSchemesId == item.clinicSchemesId
            ? "active departmentItem"
            : "departmentItem"
        }
        onClick={() => {
          props.goSelectTooth(item);
        }}
      >
        <View
          className="departmentItemImg"
          style={{
            backgroundColor: item.hasClinicSchemes ? "#fafbff" : "#fff",
          }}
        >
          <Image src={api.bseUrl + item.clinicImg}></Image>
        </View>
        <View className="name">{item.clinicName}</View>
      </View>
    );
  };
  return (
    <View className="department borderBottom">
      <View className="fontBold">科室</View>
      <View className="departmentList">
        {props.deptList?.map((item) => {
          return props.show ? item.hasClinicSchemes && dom(item) : dom(item);
        })}
      </View>
    </View>
  );
};
